/*
 * Copyright (C) Michael Opitz
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
 * USA
 */
#ifndef DOM_POLICY_H
#define DOM_POLICY_H

#include <iksemel.h>
#include <boost/shared_ptr.hpp>
#include "dom.h"

/**
 * \brief This namespace contains all model-classes.
 * \author Michael Opitz
 */
namespace model {
	/**
	 * This class is a policy for the parser-class, which creates a 
	 * dom-parser.
	 * \author Michael Opitz <opitz.michael@gmail.com>
	 * \version 0.1
	 */
	class dom_policy {
	public:
		/**
		 * Does basically nothing.
		 */
		dom_policy();
		/**
		 * Does basically nothing.
		 */
		~dom_policy();

		/**
		 * This method is called by the inherited parser-class
		 * and creates a dom-parser.
		 * \return a iksparser-object is returned.
		 */
		iksparser* create();

		/**
		 * This method returns the dom-tree for the parsed xml-string.
		 * \return A pointer to the dom-node is returned.
		 */
		boost::shared_ptr<model::dom> get_node() {return node;}
		/**
		 * This method returns the dom-tree for the parsed xml-string.
		 * \return A pointer to the dom-node is returned.
		 */
		const boost::shared_ptr<model::dom> get_node() const 
		{
			return node;
		}
	private:
		/**
		 * This attribute stores a shared-pointer to the dom-node.
		 */
		boost::shared_ptr<model::dom> node;
	};
}
#endif
